home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-13 | 1.2 KB | 19 lines | [TEXT/ttxt] |
- On page 18 of the June 1994 develop article about Apple Guide, it states that
- "The ContextReplyProc should use NewPtr to create a storage area for a short,
- set *ppOutputData to the value of the pointer, and set *pOutputDataSize to
- sizeof(short). Always return a pointer to a short."
-
- In fact, Apple Guide uses only the first byte of the value that is returned. The
- *pOutputDataSize value is ignored. The correct statement is "The
- ContextReplyProc should use NewPtr to create a storage area for a Boolean, set
- *ppOutputData to the value of the pointer, and set *pOutputDataSize to
- sizeof(Boolean). Always return a pointer to a Boolean."
-
- The MoGuide sample source uses a short, but it is cast to a char when it assigns
- the result. Consequently, the MoGuide example returns the equivalent of a
- Boolean because of the modern miracles of compiler casting. If an engineer
- follows the MoGuide example exactly, the context check will work. However, most
- will return a pointer to the short per the instructions and, since Apple Guide
- uses only the first byte of the short, the result will always be interpreted as
- false. The correct action is to return a pointer to a Boolean.
-